---
- name: Add fish repository
  become: true
  ansible.builtin.apt_repository:
    repo: ppa:fish-shell/release-3
    state: present

- name: Install fish shell
  become: true
  ansible.builtin.apt:
    update_cache: true
    state: present
    name:
      - fish

- name: Change the shell to fish
  ansible.builtin.user:
    name: "{{ user }}"
    shell: /usr/bin/fish

- name: Ensure fisher installed
  register: fisher
  ansible.builtin.stat:
    path: "{{ fish_conf_dir }}/functions/fisher.fish"

- name: Install fisherman
  when: fisher.failed
  ansible.builtin.command: >
    /usr/bin/fish -c "curl -sL {{ fish_fisher_git_url }} | source;
    fisher install jorgebucaran/fisher"
